<!DOCTYPE html>

<html>

<head>

	<title>编辑店铺</title>

	<include file='public/head'>

	<style>

		.layui-legend-size{font-size:14px !important;}

		.layui-nopadding{padding:0 !important;}

		.layui-overflow{overflow:auto;}

		.layui-nomargin{margin: 0 !important;}

		.layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}

		.layui-input{height:30px !important; }

		.layui-form-search-item .layui-inline{margin-bottom: 5px;} 

		.layui-form-search-item label{margin-left: 15px;}

		.layui-table-page {padding: 7px 0px 0px;}

		.layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}

	</style>		

</head>

<body>

<form id="f" class="layui-form">

	<input type="hidden" value="{$store->store_id}" name="store_id">

<!-- layui-tab开始 -->

<div class="layui-tab " lay-filter="demo-tab">

	<!-- 表格内容开始 -->

	<div class="layui-card">

		<div class="layui-card-body layui-nopadding " >

			<fieldset class="layui-elem-field layui-field-title layui-field-padding">

				<legend class="layui-legend-size">店铺信息</legend>

				<table  class="layui-table layui-nomargin" >

					<tr>

						<td rowspan="5" width="20%">

							<center>

								<img src="{$store->store_log}" class="upimg" lay-data="{data:{info:'log'}}">

								<input type="hidden" value="{$store->store_log}" name="store_log">

							</center>

						</td>

						<td width="10%">用户ID</td>

						<td>{$store->uid}</td>

						<td width="10%">手机号</td>

						<td>

							<input type="text" class="layui-input" value="{$store->store_principal_phone}" name="store_principal_phone">

						</td>

					</tr>

					<tr>

						<td>店铺老板</td>

						<td>

							<input type="text" class="layui-input" value="{$store->store_principal}" name="store_principal">

						</td>

						<td>店铺名称</td>

						<td>

							<input type="text" class="layui-input" value="{$store->store_name}" name="store_name">

						</td>

					</tr>

					<tr>

						<td>主营业务</td>

						<td>

							<input type="text" class="layui-input" value="{$store->store_type}" name="store_type">

						</td>

						<td></td>

						<td>

						</td>

					</tr>

					<tr>

						<td>身份证</td>

						<td>

							<input type="text" class="layui-input" value="{$store_info->store_idcard}" name="store_idcard">

						</td>

						<td></td>

						<td></td>

					</tr>

					<tr>

						<td>营业地</td>

						<td colspan="3">

							<input type="text" class="layui-input" value="{$store->address}" name="address">

						</td>

					</tr>

				</table>

			</fieldset>

		</div>

	</div>



	<div class="layui-card">

		<div class="layui-card-body layui-nopadding " >

				<fieldset class="layui-elem-field layui-field-title layui-field-padding">

					<legend class="layui-legend-size">证件信息</legend>

					<table  class="layui-table layui-nomargin" >

						<tr>

							<td width="25%">身份证正面</td>

							<td width="25%">身份证反面</td>

							<td width="25%">手持身份证</td>

							<td width="25%">营业执照</td>

						</tr>

						<tr>

							<td>

								<center>

									<img src="{$store_info->store_idcard_img_front}" class="upimg" lay-data="{data:{info:'idcard_img_front'}}">

									<input type="hidden" value="{$store_info->store_idcard_img_front}" name="store_idcard_img_front">

								</center>

							</td>

							<td>

								<center>

									<img src="{$store_info->store_idcard_img_reverse}" class="upimg" lay-data="{data:{info:'idcard_img_reverse'}}">

									<input type="hidden" value="{$store_info->store_idcard_img_reverse}" name="store_idcard_img_reverse">

								</center>

							</td>

							<td>

								<center>

									<img src="{$store_info->store_hand_idcard_img}" class="upimg" lay-data="{data:{info:'hand_idcard_img'}}">

									<input type="hidden" value="{$store_info->store_hand_idcard_img}" name="store_hand_idcard_img">

								</center>

							</td>

							<td>

								<center>

									<img src="{$store_info->store_business_img}" class="upimg" lay-data="{data:{info:'business_img'}}">

									<input type="hidden" value="{$store_info->store_business_img}" name="store_business_img">

								</center>

							</td>

						</tr>

					</table>

				</fieldset>

			</div>

		</div>

	</div>

</form>

</div>



	<include file='public/scripts'>



<script type="text/javascript">

	function tijiao(){

		//提交

		$.ajax({

			url:"{:cmf_plugin_url('Store://admin_index/editStore')}",

			data: $('#f').serialize(),

			type:'post',

			success:function(data){

				if (data.code == 1) {

					layer.msg(data.msg,{icon:1,time:1500},function(){

						parent.layer.closeAll();

						parent.location.reload(); 

					});

				} else {

					layer.msg(data.msg,{icon:2,time:1500});

				}

			},

			error:function()

			{

				layer.msg('系统错误',{icon:2,time:1500});

			}

		})

	}



var upload = layui.upload; //得到 upload 对象

upload.render({

  elem: '.upimg'

  ,url:"{:cmf_plugin_url('Store://admin_index/pzUpload')}"

  ,accept:'image'

  ,auto:true

  ,before:function(obj){

  	//选择后到上传前的事件

    var item = this.item;

    // 预览

    obj.preview(function(index,file,result) {

        $(item).attr('src',result);

    }); 	

  }

  ,done: function(res, index, upload){

    //获取当前触发上传的元素，一般用于 elem 绑定 class 的情况，注意：此乃 layui 2.1.0 新增

    var item = this.item;

    // console.log(item);

	if(res != null){

        //将控制器返回的路径放入隐藏的input中

        // $(item).parent().find("input[name=image]").val(res.save);



        $(item).parent().find("input[name='store_"+res.info+"']").val(res.save);

        // $('#pic_save').val(res.save);        		

        layer.msg('上传成功');

	}else{

		layer.msg('上传失败');

	}    

  }

	,error:function(index,upload) {

	    layer.msg('上传失败');

	}

})



</script>



</body>

</html>